package com.cb.web.wasf.sample.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * @author CBO
 */
@Entity
@Table(name="USER", uniqueConstraints=@UniqueConstraint(name="LOGIN_UK", columnNames={"LOGIN"}))
public class UserBO implements Serializable {

    @Id
    @GeneratedValue
    private Long id;
    @Column(name="LOGIN", unique = true, nullable = false, length=50)
    private String login;
    @Column(nullable = false, length=50)
    private String passwordHash;
    @Column(nullable = false, length=20)
    private String firstName;
    @Column(nullable = false, length=20)
    private String lastName;
    @Column(nullable = false, length=100)
    private String mail;
    @Column(nullable = false)
    private Boolean enable;
    @ManyToMany
    private Set<ProfilBO> profils = new HashSet<ProfilBO>();

    public Long getId() {
        return id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPasswordHash() {
        return passwordHash;
    }

    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Set<ProfilBO> getProfils() {
        return profils;
    }

    public void setProfils(Set<ProfilBO> profils) {
        this.profils = profils;
    }

}
